package com.cpit.platform.commontable.dao;

import com.cpit.platform.common.dao.SimpleExpression;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

public interface CommonTableRepository<ID extends Serializable>{
    Map save(String tableName,Map entity);

    Integer modify(String tableName,Long id,Map entity);

    List findByColumnEqual(String tableName, String columnName, Object columnValue );
    List findByCondition(String tableName, SimpleExpression simpleExpression) ;
    Page<Map<String, Object>>  findByCondition(String tableName, SimpleExpression simpleExpression, Pageable pageable);
    List findByCondition(String tableName,  Map queryCondMap);
    Page<Map<String, Object>>  findByCondition(String tableName,  Map queryCondMap, Pageable pageable);
    Page<Map<String, Object>> findByCondition(String tableName, Map queryCondMap , List<SimpleExpression> queryCondSimple, Pageable pageable);
    List findByCondition(String tableName, Map queryCondMap ,List<SimpleExpression> queryCondSimple);
    List findAll(String tableName);
    int delete(String tableName,Long id);
    int delete(String tableName, Map queryCondMap ,List<SimpleExpression> queryCondSimple);
    List<Map> getColumnMetaList(String tableName);
    Class getColumnType( List<Map> columnMetaList,String fieldName);
}